﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace Game
{
    partial class Main
    {
        void newGame_bttn_MouseEnter(object sender, System.EventArgs e)
        {
            this.newGame_bttn.Image = global::Game.Properties.Resources.new_game_button_act;
        }

        void newGame_bttn_MouseLeave(object sender, System.EventArgs e)
        {
            this.newGame_bttn.Image = global::Game.Properties.Resources.new_game_button;
        }

        void newGame_bttn_MouseHover(object sender, System.EventArgs e)
        {
            this.newGame_bttn.Image = global::Game.Properties.Resources.new_game_button_act;
        }
        void Settinngs_bttn_MouseLeave(object sender, System.EventArgs e)
        {
            this.Settinngs_bttn.Image = global::Game.Properties.Resources.settings_button;
        }

        void Settinngs_bttn_MouseEnter(object sender, System.EventArgs e)
        {
            this.Settinngs_bttn.Image = this.Settinngs_bttn.Image = global::Game.Properties.Resources.settings_button_act;
        }

        void Settinngs_bttn_MouseHover(object sender, System.EventArgs e)
        {
            this.Settinngs_bttn.Image = this.Settinngs_bttn.Image = global::Game.Properties.Resources.settings_button_act;
        }
        void Exit_bttn_MouseLeave(object sender, System.EventArgs e)
        {
            this.Exit_bttn.Image = global::Game.Properties.Resources.exit_button;
        }

        void Exit_bttn_MouseHover(object sender, System.EventArgs e)
        {
            this.Exit_bttn.Image = global::Game.Properties.Resources.exit_button_act;
        }

        void Exit_bttn_MouseEnter(object sender, System.EventArgs e)
        {
            this.Exit_bttn.Image = global::Game.Properties.Resources.exit_button_act;
        }
        void startGame_bttn_MouseLeave(object sender, System.EventArgs e)
        {
            this.startGame_bttn.Image = global::Game.Properties.Resources.begin_button;
        }

        void startGame_bttn_MouseHover(object sender, System.EventArgs e)
        {
            this.startGame_bttn.Image = global::Game.Properties.Resources.begin_button_act;
        }

        void startGame_bttn_MouseEnter(object sender, System.EventArgs e)
        {
            this.startGame_bttn.Image = global::Game.Properties.Resources.begin_button_act;
        }

        void settingsSave_bttn_MouseLeave(object sender, System.EventArgs e)
        {
            this.settingsSave_bttn.Image = global::Game.Properties.Resources.save_settings_button;
        }

        void settingsSave_bttn_MouseHover(object sender, System.EventArgs e)
        {
            this.settingsSave_bttn.Image = global::Game.Properties.Resources.save_settings_button_act;
        }

        void settingsSave_bttn_MouseEnter(object sender, System.EventArgs e)
        {
            this.settingsSave_bttn.Image = global::Game.Properties.Resources.save_settings_button_act;
        }


        void settingsCancel_bttn_MouseLeave(object sender, System.EventArgs e)
        {
            this.settingsCancel_bttn.Image = global::Game.Properties.Resources.cancel_settings_button;
        }

        void settingsCancel_bttn_MouseHover(object sender, System.EventArgs e)
        {
            this.settingsCancel_bttn.Image = global::Game.Properties.Resources.cancel_settings_button_act;
        }

        void settingsCancel_bttn_MouseEnter(object sender, System.EventArgs e)
        {
            this.settingsCancel_bttn.Image = global::Game.Properties.Resources.cancel_settings_button_act;
        }

        void settingsCancel_bttn_Click(object sender, EventArgs e)
        {
            this.difficulty = 1;
            this.sound = 1;
            this.graphic = 1;
            this.shw_MainDialog();
        }

        void settingsSave_bttn_Click(object sender, EventArgs e)
        {
            this.shw_MainDialog();
        }

        void settingsDifficulty_lbttn_MouseLeave(object sender, System.EventArgs e)
        {
            this.settingsDifficulty_lbttn.Image = global::Game.Properties.Resources.settings_difficulty_left_button;
        }

        void settingsDifficulty_lbttn_MouseHover(object sender, System.EventArgs e)
        {
            this.settingsDifficulty_lbttn.Image = global::Game.Properties.Resources.settings_difficulty_left_button_act;
        }

        void settingsDifficulty_lbttn_MouseEnter(object sender, System.EventArgs e)
        {
            this.settingsDifficulty_lbttn.Image = global::Game.Properties.Resources.settings_difficulty_left_button_act;
        }

        void settingsDifficulty_rbttn_MouseLeave(object sender, EventArgs e)
        {
            this.settingsDifficulty_rbttn.Image = global::Game.Properties.Resources.settings_difficulty_right_button;
        }

        void settingsDifficulty_rbttn_MouseHover(object sender, EventArgs e)
        {
            this.settingsDifficulty_rbttn.Image = global::Game.Properties.Resources.settings_difficulty_right_button_act;
        }

        void settingsDifficulty_rbttn_MouseEnter(object sender, EventArgs e)
        {
            this.settingsDifficulty_rbttn.Image = global::Game.Properties.Resources.settings_difficulty_right_button_act;
        }

        void settingsDifficulty_Click(object sender, EventArgs e)
        {
            if (this.difficulty == 1 )
            {
                this.settingsDifficulty_img.Image = global::Game.Properties.Resources.settings_difficulty_medium;
                this.difficulty = 2;
            }
            else
                if (this.difficulty == 2)
            {
                this.settingsDifficulty_img.Image = global::Game.Properties.Resources.settings_difficulty_hard;
                this.difficulty = 3;
            }
            else
                    if (this.difficulty == 3)
            {
                this.settingsDifficulty_img.Image = global::Game.Properties.Resources.settings_difficulty_easy;
                this.difficulty = 1;
            }
        }

        void settingsGraphic_lbttn_MouseLeave(object sender, EventArgs e)
        {
            this.settingsGraphic_lbttn.Image = global::Game.Properties.Resources.settings_graphic_left_button;
        }

        void settingsGraphic_lbttn_MouseHover(object sender, EventArgs e)
        {
            this.settingsGraphic_lbttn.Image = global::Game.Properties.Resources.settings_graphic_left_button_act;
        }

        void settingsGraphic_lbttn_MouseEnter(object sender, EventArgs e)
        {
            this.settingsGraphic_lbttn.Image = global::Game.Properties.Resources.settings_graphic_left_button_act;
        }

        void settingsGraphic_rbttn_MouseLeave(object sender, EventArgs e)
        {
            this.settingsGraphic_rbttn.Image = global::Game.Properties.Resources.settings_graphic_right_button;
        }

        void settingsGraphic_rbttn_MouseHover(object sender, EventArgs e)
        {
            this.settingsGraphic_rbttn.Image = global::Game.Properties.Resources.settings_graphic_right_button_act;
        }

        void settingsGraphic_rbttn_MouseEnter(object sender, EventArgs e)
        {
            this.settingsGraphic_rbttn.Image = global::Game.Properties.Resources.settings_graphic_right_button_act;
        }

        void settingsGraphic_Click(object sender, EventArgs e)
        {
            if (this.graphic == 1)
            {
                this.graphic = 2;
                this.settingsGraphic_img.Image = global::Game.Properties.Resources.settings_graphics_medium;
            }
            else
            if (this.graphic == 2)
            {
                this.graphic = 3;
                this.settingsGraphic_img.Image = global::Game.Properties.Resources.settings_graphics_hight;
            }
            else
            if (this.graphic == 3)
            {
                this.graphic = 1;
                this.settingsGraphic_img.Image = global::Game.Properties.Resources.settings_graphics_low;
            }
        }
        void settingsSound_Click(object sender, EventArgs e)
        {
            if (this.sound == 1)
            {
                this.sound = 2;
                this.settingsSound_img.Image = global::Game.Properties.Resources.settings_sound_on;
            }
            else
                if (this.sound == 2)
                {
                    this.sound = 1;
                    this.settingsSound_img.Image = global::Game.Properties.Resources.settings_sound_off;
                }
        }

        void settingsSound_lbttn_MouseLeave(object sender, EventArgs e)
        {
            this.settingsSound_lbttn.Image = global::Game.Properties.Resources.settings_sound_left_button;
        }

        void settingsSound_lbttn_MouseHover(object sender, EventArgs e)
        {
            this.settingsSound_lbttn.Image = global::Game.Properties.Resources.settings_sound_left_button_act;
        }

        void settingsSound_lbttn_MouseEnter(object sender, EventArgs e)
        {
            this.settingsSound_lbttn.Image = global::Game.Properties.Resources.settings_sound_left_button_act;
        }

        void settingsSound_rbttn_MouseLeave(object sender, EventArgs e)
        {
            this.settingsSound_rbttn.Image = global::Game.Properties.Resources.settings_sound_right_button;
        }

        void settingsSound_rbttn_MouseHover(object sender, EventArgs e)
        {
            this.settingsSound_rbttn.Image = global::Game.Properties.Resources.settings_sound_right_button_act;
        }

        void settingsSound_rbttn_MouseEnter(object sender, EventArgs e)
        {
            this.settingsSound_rbttn.Image = global::Game.Properties.Resources.settings_sound_right_button_act;
        }
        void startGame_bttn_Click(object sender, EventArgs e)
        {
            this.startGame();
        }
        private void checkGameOver_Tick(object sender, EventArgs e)
        {
            if (this.player.PropX == 405 && this.player.PropY == 405)
            {
                this.level++; // повышение переменной номера уровня
                if (level <= 2)
                {
                    this.lb.changeLevel(this.level); // смена уровня
                    this.lives = this.player.PropLives;
                    this.player = new Player(); // создание экземпляра класса игрока
                    this.player.setLives(this.lives);
                    this.drw_Labirint(); // "перерисока" лабиринта
                    //this.crt_Hunters(); // обновление охотников
                    this.drw_Hunters();
                    this.moveHunters.Start();
                    this.drw_Player(); // "перерисовка" игрока
                }
                else
                {
                    this.gameOver(); // конец игры
                }
            }
        }

        private void newGame_bttn_Click(object sender, EventArgs e)
        {
            this.shw_NewGameDialog();
        }

        private void addTime_Tick(object sender, EventArgs e)
        {
            this.time++;
            if (this.player.PropLives == 0)
            {
                this.gameOver();
            }
        }

        private void updateInfo_Tick(object sender, EventArgs e)
        {
            this.score = (this.time - this.steps) / 10;
            this.info.Text = " " + this.player_name + "\n\n Level: " + this.lb.PropLevel + "\n Score: " + this.score;
            this.drw_Lives();
        }
        private void moveHunters_Tick(object sender, EventArgs e)
        {
            Size sz = this.player.getMatrixPosition(); // положение в матрице игрока
            for (int i = 0; i < this.hunters.Length; i++)
            {
                Size hz = this.hunters[i].getMatrixPosition(); // положение в матрице текущего охотника
                this.moveHunter(i);
                this.TryToKill(i);
            }
            this.drw_Hunters();
        }
    }
}
